package com.onesatoshi.mm.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelp extends SQLiteOpenHelper {

    private static final String DATABASE_NAME = "mysqlitedb";

    public DBHelp(Context context) {
        super(context, DATABASE_NAME, null, 1);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {

        // t_user
        String sql = "create table IF NOT EXISTS t_user(_id integer primary key autoincrement, username text, phone text, status text, nickname text, wxid text)";
        db.execSQL(sql);

        // t_setting
        sql = "create table IF NOT EXISTS t_setting(_id integer primary key autoincrement, property text, value text, status text)";
        db.execSQL(sql);

        // t_chat
        sql = "create table IF NOT EXISTS t_chat(_id integer primary key autoincrement, nickname text, wxid text, deviceid text, type text, content text, status text)";
        db.execSQL(sql);

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }

}
